# list = ['Alex', 'Wang', 'Chen', 'Rose', 'William']
# loop = []

# while list:
#   loop.append(list.pop())

# print (list)
# # []
# print (loop)
# # ['William', 'Rose', 'Chen', 'Wang', 'Alex']



# 删除指定元素  remove
pets = ['dog', 'cat', 'dog', 'foldfish', 'cat', 'rabbit', 'cat']

while 'cat' in pets:
  pets.remove('cat')

print (pets)
# ['dog', 'dog', 'foldfish', 'rabbit']